<!--
 * @description: 
 * @Date: 2022-11-02 21:36:32
 * @LastEditTime: 2022-11-09 19:37:15
-->
<template>
  <div class="manager-setting">
    <el-select v-model="type" class="w-full mb-3">
      <el-option label="文件刷新" value="file"></el-option>
      <el-option label="目录刷新" value="directory"></el-option>
    </el-select>
    <el-input
      type="textarea"
      rows="20"
      v-model="refreshText"
      placeholder="请输入需要刷新的目录以/结尾&#10;多个地址请换行每行写一个&#10;例如 https://mtab.cc/"
    ></el-input>
    <el-button @click="submit" class="w-full mt-3" type="primary">提交</el-button>
  </div>
</template>
<script setup>
import { ElMessage, ElMessageBox } from "element-plus";
import { ref } from "vue";
import ajax from "../../util/ajax";
import sm from "../../util/sm2";
const refreshText = ref("");
const type = ref("file");
const submit = () => {
  if (refreshText.value.trim()) {
    let list = refreshText.value.split("\n");
    ajax({
      url: "admin/refreshCdn",
      method: "post",
      data: { urls: list, type: type.value },
    }).then((el) => {
      if (el.code == 1) {
        ElMessage.success("刷新成功");
      } else {
        ElMessage.success("请重新尝试");
      }
    });
  }
};
</script>
<style lang="less"></style>
